<?php

namespace App\Kuafu\User\Validate;

use App\Exceptions\CustomValidateException;
use App\Http\Validate\AbstractBaseValidate;
use Illuminate\Support\MessageBag;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;

class UserValidateNew extends AbstractBaseValidate
{
    /**
     * @inheritDoc
     */
    function getRules(): array
    {
        // TODO: Implement getRules() method.
        return [];
    }

    /**
     * @inheritDoc
     */
    function getAttributes(): array
    {
        // TODO: Implement getAttributes() method.
        return [];
    }

    /**
     * @inheritDoc
     */
    function registerValidateRules(): void
    {
        // TODO: Implement registerValidateRules() method.
    }

    /**
     * @inheritDoc
     */
    function getMessages(): array
    {
        // TODO: Implement getMessages() method.
        return [];
    }

    /**
     * 用户角色校验
     *
     * @param array $params
     * @return MessageBag|object
     * @throws CustomValidateException
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     */
    public static function userRoleValidate(array $params)
    {
        return self::getInstance()->validate(
            ["userIds", "shopId", "brandId", "type"],
            $params,
            [
                "userIds"   => "required|array|min:1",
                "userIds.*" => "int|min:1",
                "shopId"    => "required|int",
                "brandId"   => "required|int",
                "type"      => "required|int"
            ]
        );
    }

    /**
     * @param array $params
     * @return MessageBag|object
     * @throws ContainerExceptionInterface
     * @throws CustomValidateException
     * @throws NotFoundExceptionInterface
     */
    public static function fsUserByUserIdsValidate(array $params)
    {
        return self::getInstance()->validate(
            ["userIds"],
            $params,
            [
                "userIds"   => "required|array|min:1",
                "userIds.*" => "int|min:1",
            ]
        );
    }
}
